home *** CD-ROM | disk | FTP | other *** search
- #!/bin/csh -f
- # Installation script for MAEstro unsupported source code.
- # Copyright (C) 1994 by George D. Drapeau
- #
-
- set OsRelease = `uname -r` # What release of the operating system is this?
- switch ($OsRelease)
- case "4.*": # SunOS 4.X
- set RootDir = /cdrom/MAEstro/unsupported # Set top-level directory from which to retrieve unsupported stuff
- breaksw
- case "5.*": # SunOS 5.X
- set RootDir = /cdrom/unnamed_cdrom/MAEstro/unsupported # Set top-level directory from which to retrieve unsupported stuff
- breaksw
- default: # Probably not any SunOS
- set RootDir = /cdrom/MAEstro/unsupported # Set top-level directory from which to retrieve unsupported stuff
- breaksw
- endsw
-
- set DestDir = "/usr/local/MAEstro" # Set up a default directory for the unsupported stuff
- set OsType = `uname -s` # Determine the operating system type
-
- set MAEstroLibDir = "$RootDir" # Determine where to find the correct MAEstro extras
-
- if (!(-e $MAEstroLibDir)) then
- echo "Cannot find the directory $RootDir. Please make sure"
- echo "that you have mounted the CD-ROM as /cdrom (for SunOS 4.x systems)"
- echo "or /cdrom/unnamed_cdrom (for Solaris 2.X systems running Volume Manager),"
- echo "then try this installation script again."
- exit (-1)
- endif
-
- set DiskSpaceNeeded = `du -s $MAEstroLibDir | awk '{print $1}'` # Determine disk space needed to install unsupported software
-
- echo ""
- echo "The default installation directory is "
- echo " $DestDir"
- echo ""
- echo "The unsupported source code requires $DiskSpaceNeeded KB of disk space."
- echo ""
- echo "Would you like to install the unsupported source code into "
- echo -n "'$DestDir'? [y/n] "
- set DestDir_ok = $< # Ask the installer if the default directory is okay.
-
-
- CustomInstallDirectory: # Here begins code to install apps in a custom directory
-
- if ($DestDir_ok != y) then # The default directory is not okay, prompt for a new place
- echo ""
- echo "Where would you like to install the unsupported source code? "
- echo "(type 'q' to quit the installation process now.)"
- echo -n "--> "
- set DestDir = $<
- endif
-
- if ($DestDir == "q") then # Did the installer choose to exit without installing the software?
- echo "Unsupported software was not installed."
- exit (-1) # Yes, honor that choice and quit right now
- endif
-
- if (!(-e $DestDir)) then # Does the specified directory exist?
- echo ""
- echo "The directory '$DestDir' does not exist."
- echo -n "Would you like to create it? [y/n] " # No, shall this program create such a directory?
- set create = $<
- if ($create == y) then # Yes, try to create the directory specified by the installer
- echo -n "Creating installation directory..."
- mkdir $DestDir >& /dev/null # Create the directory and set appropriate permissions
- if ($status != 0) then
- echo ""
- echo "Could not create the directory $DestDir."
- echo "Please try another directory name."
- echo ""
- goto CustomInstallDirectory
- endif
- chmod 0755 $DestDir
- echo "Done."
- else
- echo "Please try again:"
- echo ""
- goto CustomInstallDirectory
- endif
- else
- echo ""
- endif
-
- if (!(-e $DestDir/Source)) then # Does the "Source" directory exist?
- mkdir $DestDir/Source >& /dev/null # No, try to create it
- if ($status != 0) then # Did the creation fail?
- echo "" # Yes, report the error and exit without doing anything more
- echo "Could not create the directory $DestDir/Source."
- echo "Please make sure you have permission to create directories under"
- echo "$DestDir then run this installation script again."
- exit (-1)
- endif
- endif
-
-
- #
- # Avoid problems with long df entries...
- #
- set DF_LONG = `df $DestDir | tail -1 | awk '{print $4}' | egrep % | wc -c`
- if ( $DF_LONG == "0" ) then
- set FreeDiskSpace = `df $DestDir | tail -1 | awk '{print $4}'`
- else
- set FreeDiskSpace = `df $DestDir | tail -1 | awk '{print $3}'`
- endif
-
- if ($FreeDiskSpace < $DiskSpaceNeeded) then # Is there enough space to hold the MAEstro apps?
- echo "Sorry, the unsupported software requires $DiskSpaceNeeded KB of free disk space" # No, inform the installer
- echo "but there are only $FreeDiskSpace KB free in '$DestDir'."
- echo "Please free up disk space or install unsupported software"
- echo "in a different directory, then run this installation script again."
- exit (-1) # Exit this script without doing any installation
- endif
-
-
- echo ""
- echo -n "Installing unsupported software into '$DestDir'..."
-
- cp -r $MAEstroLibDir/* $DestDir/Source # Copy the unsupported software into the desired directory
-
- echo "Done."
-
- echo ""
- echo 'Installation was successful. Enjoy\!'
-
- exit (0) # Installation was successful; get outtahere.
-